package cn.edu.scau.cmi.suyaoxing.client;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import cn.edu.scau.cmi.suyaoxing.client.*;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

public class ComprehensionClient extends Application{
	public static void main(String[] args) {
		launch(args);
	}

	public void start(Stage primaryStage) {
		GridPane gridpane = new GridPane();
		gridpane.setAlignment(Pos.CENTER);
		gridpane.setHgap(1);
		gridpane.setVgap(1);

		Button bt1=new Button("实验二:单例模式");
		Button bt2=new Button("实验二:多例模式");
		Button bt3=new Button("实验三:简单工厂模式");
		Button bt4=new Button("实验三:工厂模式");
		Button bt5=new Button("实验三:抽象工厂模式");
		Button bt6=new Button("实验四:对象适配器模式");
		Button bt7=new Button("实验四:类适配器模式");
		Button bt8=new Button("实验五:安全型组合模式");
		Button bt9=new Button("实验五:一致型组合模式");
		
		Image image=new Image("/res/factory_1.jpg");
		ImageView imageview=new ImageView(image);
		imageview.setFitHeight(300);
	    imageview.setFitWidth(600);
		Label lb1=new Label("201627010214 苏耀星");
		
		bt1.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				SingletonClient singletonClient=new SingletonClient();
				singletonClient.start(new Stage());
			}
		});
		bt2.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				MultitonClient multitonClient=new MultitonClient();
				multitonClient.start(new Stage());
			}
		});
		bt3.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				SimpleFactoryClient simpleFactoryClient=new SimpleFactoryClient();
				simpleFactoryClient.start(new Stage());
			}
		});
		bt4.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				FactoryClient factoryClient=new FactoryClient();
				factoryClient.start(new Stage());
			}
		});
		bt5.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				AbstractFactoryClient abstractFactoryClient=new AbstractFactoryClient();
				abstractFactoryClient.start(new Stage());
			}
		});
		bt6.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				AdapterOfClassClient adapterOfClassClient=new AdapterOfClassClient();
				adapterOfClassClient.start(new Stage());
			}
		});
		bt7.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				AdapterOfObjectClient adapterOfObjectClient=new AdapterOfObjectClient();
				adapterOfObjectClient.start(new Stage());
			}
		});
		bt8.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				SafeCompositeClient safeCompositeClient=new SafeCompositeClient();
				safeCompositeClient.start(new Stage());
			}
		});
		bt9.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
				ConsistentCompositeClient consistentCompositeClient=new ConsistentCompositeClient();
				consistentCompositeClient.start(new Stage());
			}
		});
		
		
		gridpane.add(imageview,0,0,10,20);
		gridpane.add(lb1,0,22,1,10);
		gridpane.add(bt1, 12, 0);
		gridpane.add(bt2, 12, 2);
		gridpane.add(bt3, 12, 4);
		gridpane.add(bt4, 12, 6);
		gridpane.add(bt5, 12, 8);
		gridpane.add(bt6, 12, 10);
		gridpane.add(bt7, 12, 12);
		gridpane.add(bt8, 12, 14);
		gridpane.add(bt9, 12, 16);
		
		Scene scene = new Scene(gridpane, 1100, 500);
		primaryStage.setTitle("综合性实验1");
		primaryStage.setScene(scene);
		primaryStage.show();
	}
}
